var QQMapWX = require('../../libs/qqmap-wx-jssdk.min.js');

var app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    navbar: ['首页', '限时特惠', '男装', '女装', '童装', '箱包'],
    currentTab: 0,
    indexMovies: [{
      url: '../../assets/image/TB2xkaBaMFkpuFjSspnXXb4qFXa-45620536拷贝2@2x.png'
    }],
    movies: [{
      url: '../../assets/image/图层9@2x.png'
    }],
    shangpinItems: [{
        typeId: 0,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png',
      },

      {
        typeId: 1,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png',
      },
      {
        typeId: 2,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 3,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 4,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 5,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 6,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 7,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      },
      {
        typeId: 8,
        name: '',
        url: 'bill',
        imageurl: '/assets/image/组7拷贝@2x.png'
      }
    ],
    leixingItems: [{
      typeId: 0,
      name: '印花短T恤',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_13.png',
    },

    {
      typeId: 1,
      name: '雪纺/轻柔',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_15.png',
    },
    {
      typeId: 2,
      name: 'Bra内衣',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_17.png'
    },
    {
      typeId: 3,
      name: '清凉系列',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_19.png'
    },
    {
      typeId: 4,
      name: '针织/毛衣',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_21.png'
    },
    {
      typeId: 5,
      name: '机能外套',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_35.png'
    },
    {
      typeId: 6,
      name: '中/短裤',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_37.png'
    },
    {
      typeId: 7,
      name: '裙装',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_39.png'
    },
    {
      typeId: 8,
      name: '鞋类',
      url: 'bill',
      imageurl: '/assets/image/未标题-1_41.png'
    }
    ]
  },
  navbarTap: function(e) {
    this.setData({
      currentTab: e.currentTarget.dataset.idx
    })
  },
  toServe: function() {
    wx.navigateTo({
      url: '../serve/serve'
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var _this = this;
    wx.getSystemInfo({
      success: function(res) {
        //设置map高度，根据当前设备宽高满屏显示
        // _this.setData({
        //   view: {
        //     Height: 150,
        //   }
        // })
      }
    })

    wx.getLocation({
      type: 'wgs84', // 默认为 wgs84 返回 gps 坐标，gcj02 返回可用于 wx.openLocation 的坐标  
      success: function(res) {
        _this.setData({
          latitude: res.latitude,
          longitude: res.longitude,
          markers: [{
            id: "1",
            latitude: res.latitude,
            longitude: res.longitude,
            width: 20,
            height: 20,
            iconPath: "/assets/ic_location.png",
            title: "我的当前位置"
          }],

        })
      }
    })
  },
  regionchange(e) {
    console.log("regionchange===" + e.type)
  },
  //点击merkers  
  markertap(e) {
    console.log(e.markerId)
    wx.showActionSheet({
      itemList: ["我的位置"],
      success: function(res) {
        console.log(res.tapIndex)
      },
      fail: function(res) {
        console.log(res.errMsg)
      }
    })
  },

  //点击缩放按钮动态请求数据  
  controltap(e) {
    var that = this;
    console.log("scale===" + this.data.scale)
    if (e.controlId === 1) {
      that.setData({
        scale: --this.data.scale
      })
    } else {
      that.setData({
        scale: ++this.data.scale
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },
})